package profiler.parameters.monitors;

import org.apache.commons.lang3.StringUtils;
import org.hyperic.sigar.Mem;
import org.hyperic.sigar.Sigar;
import org.hyperic.sigar.SigarException;

public class MemoryParameter extends GenericParameter{

	private static final double BYTE = 1.0;
	private static final double GIGA = 1073741824.0;
	
	
	private static Mem memValue;
	private static Sigar sigarValue = new Sigar();
	private static String id;
	
	public MemoryParameter() throws SigarException {
		super(id,sigarValue);
		setMemValue(sigarValue.getMem());
		
	}
	
	public String generateReport(){
		String report = "Total memory: " + MemoryParameter.getMemValue().getTotal()/GIGA + " GB" + "\n" +
						"Total used: " + MemoryParameter.getMemValue().getUsed()/GIGA +" GB" + "\n" +
						"Total perc: " + MemoryParameter.getMemValue().getUsedPercent()+" %"+ "\n"; 
		return report;
	}

	public static Mem getMemValue() {
		return memValue;
	}

	public static void setMemValue(Mem memValue) {
		MemoryParameter.memValue = memValue;
	}

}
